package org.bistu.course.service;

import java.util.List;

import org.bistu.course.bean.Student;
import org.bistu.course.mapper.StudentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class StudentService {
	@Autowired
	private StudentMapper studentMapper;
	
	public List<Student> findAll() {
		return studentMapper.findAll();
	}
	
	@Transactional
	public void addStudent(Student student) {
		studentMapper.addStudent(student);
	}
	
	@Transactional
	public void updataStudent(Student student) {
		studentMapper.updataStudent(student);
	}
	
	@Transactional
	public void deleteStudent(int id) {
		studentMapper.deleteStudent(id);
	}
	
	public Student findById(int id) {
		return studentMapper.findById(id);
	}
}
